//
//  WeakObject.m
//  Test
//
//  Created by Suny on 14-7-15.
//  Copyright (c) 2014年 Suny. All rights reserved.
//

#import "WeakObject.h"

@implementation WeakObject

- (instancetype)initWithObject:(id)object
{
	if (self = [self init])
	{
		self.object = object;
	}
	return self;
}


- (BOOL)isEqual:(id)object
{
    if(![object isKindOfClass:[WeakObject class]]) return NO;
    
    WeakObject *weakObject = object;
    return (weakObject.object == self.object || [weakObject.object isEqual:self.object]);
}

- (NSUInteger)hash
{
	if (self.object)
	{
		return [self.object hash];
	}
    else
	{
		return [self hash];
	}
}

- (void)dealloc
{
}
@end
